package com.ruoyi.purchase.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.purchase.utils.MyIncrementGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.purchase.mapper.FirmPurchaseMapper;
import com.ruoyi.purchase.domain.FirmPurchase;
import com.ruoyi.purchase.service.IFirmPurchaseService;

/**
 * 采购表Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-07-16
 */
@Service
public class FirmPurchaseServiceImpl implements IFirmPurchaseService 
{
    @Autowired
    private FirmPurchaseMapper firmPurchaseMapper;

    /**
     * 查询采购表
     * 
     * @param id 采购表主键
     * @return 采购表
     */
    @Override
    public FirmPurchase selectFirmPurchaseById(Long id)
    {
        return firmPurchaseMapper.selectFirmPurchaseById(id);
    }

    /**
     * 查询采购表列表
     * 
     * @param firmPurchase 采购表
     * @return 采购表
     */
    @Override
    public List<FirmPurchase> selectFirmPurchaseList(FirmPurchase firmPurchase)
    {
        return firmPurchaseMapper.selectFirmPurchaseList(firmPurchase);
    }

    /**
     * 新增采购表
     * 
     * @param firmPurchase 采购表
     * @return 结果
     */
    @Override
    public int insertFirmPurchase(FirmPurchase firmPurchase)
    {
        firmPurchase.setReceiptsNumber(MyIncrementGenerator.number(4));
        firmPurchase.setReceiptsDate(new Date());
        return firmPurchaseMapper.insertFirmPurchase(firmPurchase);
    }

    /**
     * 修改采购表
     * 
     * @param firmPurchase 采购表
     * @return 结果
     */
    @Override
    public int updateFirmPurchase(FirmPurchase firmPurchase)
    {
        return firmPurchaseMapper.updateFirmPurchase(firmPurchase);
    }

    /**
     * 批量删除采购表
     * 
     * @param ids 需要删除的采购表主键
     * @return 结果
     */
    @Override
    public int deleteFirmPurchaseByIds(Long[] ids)
    {
        return firmPurchaseMapper.deleteFirmPurchaseByIds(ids);
    }

    /**
     * 删除采购表信息
     * 
     * @param id 采购表主键
     * @return 结果
     */
    @Override
    public int deleteFirmPurchaseById(Long id)
    {
        return firmPurchaseMapper.deleteFirmPurchaseById(id);
    }
}
